package Homework;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class Demo06 {

	public static void main(String[] args) throws InterruptedException, ExecutionException {
		int sum = 0;
		for(int i = 1;i<=100;i+=10){
			GetSum mySum = new GetSum(i);
			FutureTask<Integer> ft = new FutureTask<>(mySum);
			Thread thread2 = new Thread(ft);
			thread2.start();		
			sum+=ft.get();
			System.out.println(ft.get());
		}
		System.out.println(sum);
	}

}
